package com.adopapa.nezhacloud.innerapi.factory;

import java.util.Map;

import org.apache.commons.lang3.exception.ExceptionUtils;
import org.springframework.stereotype.Component;

import com.adopapa.nezhacloud.common.RestResponse;
import com.adopapa.nezhacloud.innerapi.api.InnerLoginService;

@Component
public class InnerLoginFallbackFactory extends BaseFallbackFactory<InnerLoginService> {

	@Override
	public InnerLoginService create(Throwable cause) {
		logger.error("InnerUserInfoService 服务调用失败");
		logger.error(ExceptionUtils.getStackTrace(cause));
		return new InnerLoginService() {
			@Override
			public RestResponse getKaptcha() {
				return RestResponse.error(cause);
			}

			@Override
			public RestResponse auth(String token, String accessUrl) {
				return RestResponse.error(cause);
			}

			@Override
			public RestResponse login(Map<String, String> params) {
				return RestResponse.error(cause);
			}

			@Override
			public RestResponse logout() {
				return RestResponse.error(cause);
			}

			@Override
			public RestResponse refresh(String token) {
				return RestResponse.error(cause);
			}
		};
	}

}
